<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    /*
    window 是全局的
     */



    (function(){
        //假定为私有的函数
        function Timer(){
            var d = new Date();
            return d.getTime();
        }

        //外部能用的
        function Fa(){
            var t1 = Timer();
            var sum = 0;
            for(var i=0;i<100000000;i++){
                sum += i;  //sum = sum + i
            }
            var t2 = Timer();
            console.log(t2-t1);
        }
        //外部能用的
        function Fb(){
            var t1 = Timer();
            alert('Fb函数')

            var t2 = Timer();
            console.log(t2-t1);
        }
        window.Fa = Fa; //执行提升操作
        window.Fb = Fb;//执行提升操作
    })();
    Fa();
    Fb();
</script>
</body>
</html>